package com.caigou.service.impl;

import com.caigou.bean.cms.entity.AdContractAdjunct;
import com.caigou.mapper.cms.AdContractAdjunctMapper;
import com.caigou.service.AdContractAdjunctService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("adContractAdjunctService")
public class AdContractAdjunctServiceImpl implements AdContractAdjunctService {

    @Resource
    private AdContractAdjunctMapper adContractAdjunctMapper;

    @Override
    public Integer loadAdContractAdjunctCount(Integer contractId) {
        return adContractAdjunctMapper.loadAdContractAdjunctCount(contractId);
    }

    @Override
    public void deleteAdContractAdjunct(Integer contractId) {
        adContractAdjunctMapper.deleteAdContractAdjunct(contractId);
    }

    @Override
    public void saveAdContractAdjunct(Integer id, String adjunctName, String adjunctUrl) {
        AdContractAdjunct adContractAdjunct = new AdContractAdjunct();
        adContractAdjunct.setContractId(id);
        adContractAdjunct.setAdjunctName(adjunctName);
        adContractAdjunct.setAdjunctUrl(adjunctUrl);
        adContractAdjunctMapper.saveAdContractAdjunct(adContractAdjunct);
    }

    @Override
    public List<AdContractAdjunct> loadAdContractAdjunctList(Integer contractId) {
        return adContractAdjunctMapper.loadAdContractAdjunctList(contractId);
    }

    @Override
    public void deleteAdContractAdjunctById(Integer id) {
        adContractAdjunctMapper.deleteAdContractAdjunctById(id);
    }
}
